package com.cysion.study.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.cysion.study.ktbox.base.BaseAdapter
import com.cysion.study.ktbox.base.BaseViewHolder
import com.cysion.study.R
import com.cysion.study.entity.RecordEntity
import kotlinx.android.synthetic.main.item_record.view.*

class WithdrawRecordAdapter(mEntities: MutableList<RecordEntity>, mContext: Context) :
    BaseAdapter<RecordEntity>(mEntities, mContext) {

    companion object {

        //点击事件
        const val refuse = 2000
        const val agree = 2001
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<RecordEntity> {
        return ProMoneyHolder(
            LayoutInflater.from(mContext).inflate(R.layout.item_record, parent, false)
        )
    }

    class ProMoneyHolder(itemView: View) : BaseViewHolder<RecordEntity>(itemView) {
        override fun fillData(obj: RecordEntity, position: Int) {
            itemView?.apply {
                //                itemView.tv_data.text=
                ////提现类型 0.支付宝提现 1.银行卡直线
                if (obj.type == "1") {
                    tv_title.text = "提现到银行卡"
                }else if (obj.type == "0") {
                    tv_title.text = "提现到支付宝"
                } else {
                    tv_title.text = "提现到其他账户"
                }
                //提现状态 0.待处理 1.已通过 2.已拒绝
                if (obj.status == "0") {
                    tv_status.text="待处理"
                }else if (obj.status == "1") {
                    tv_status.text="已处理"
                }else if (obj.status == "2") {
                    tv_status.text="已拒绝"
                }
                tv_money.text=obj.applyMoney
                tv_card.text=obj.bankCard
                tv_time.text = obj.createTime
            }
        }

    }
}